#ifndef __TASK_STATE_HANDLING_H__
#define __TASK_STATE_HANDLING_H__

#define AP_QUEUE_MSG_MAX_LEN	40

#define VIDEO_STREAM			0x63643030
#define AUDIO_STREAM			0x62773130
#define JUNK_DATA				0x4b4e554a

#define CARD_FULL_MB_SIZE			6ULL		// <= 6MB is mean card full
#define CARD_FULL_MB_SIZE_RECORD	100ULL

#define EFFECT_CLICK			0
#define EFFECT_CAMERA			1
#define EFFECT_POWER_ON			2
#define EFFECT_POWER_OFF		3 
#define EFFECT_FILE_LOCK		4
#define EFFECT_BEEP				5
#define EFFECT_LDW_TurnOn		6
#define EFFECT_LDW_TurnOff		7
#define EFFECT_LDW_Alarm		8

//add by zzy

#define IS_FORMAT_IN_NONE                 0
#define IS_FORMAT_IN_SETTING     1
#define IS_FORMAT_IN_VIDEO         2



typedef struct
{
	INT16U	string_width;
	INT16U	string_height;
} t_STRING_TABLE_STRUCT;

typedef struct
{
	INT16U	font_color;
	INT16U	font_type;
	INT16S	pos_x;
	INT16S	pos_y;
	INT16U	buff_w;
	INT16U	buff_h;
	CHAR	*str_ptr;
} STRING_ASCII_INFO;

typedef struct
{
	INT8U	b_alarm_flag;
	INT8U	B_alarm_hour;
	INT8U	B_alarm_minute;
	INT8U	Alarm_Music_idx[3];
} ALARM_STRUCT, *pALARM_STRUCT;

typedef struct
{
	INT8U	mode;
	INT8U	on_hour;
	INT8U	on_minute;
	INT8U	off_hour;
	INT8U	off_minute;
} POWERONOFF_STRUCT, *pPOWERONOFF_STRUCT;

typedef struct
{
	INT32U	Frequency;
} FM_STATION_FORMAT;

#define FM_STATION_NUM	20

typedef struct
{
	FM_STATION_FORMAT	FM_Station[FM_STATION_NUM];
	INT8U				FM_Station_index;
} FM_INFO;

typedef struct
{
	INT8U				language;
	INT8U				date_format_display;
	INT8U				time_format_display;
	INT8U				week_format_display;
	INT8U				lcd_backlight;
	INT8U				sound_volume;
	INT8U				current_storage;
	INT8U				current_photo_index[3];
	INT8U				slideshow_duration;
	INT8U				slideshow_bg_music[3];
	INT8U				slideshow_transition;
	INT8U				slideshow_photo_date_on;
	INT8U				calendar_duration;
	INT8U				calendar_displaymode;
	INT8U				thumbnail_mode;
	INT8U				music_play_mode;
	INT8U				music_on_off;
	INT8U				midi_exist_mode;
	INT8U				factory_date[3];	//yy,mm,dd
	INT8U				factory_time[3];	//hh:mm:ss
	ALARM_STRUCT		nv_alarm_struct1;
	ALARM_STRUCT		nv_alarm_struct2;
	INT8U				alarm_modual;
	INT8U				full_screen;
	INT8U				sleep_time;
	POWERONOFF_STRUCT	powertime_onoff_struct1;
	POWERONOFF_STRUCT	powertime_onoff_struct2;
	INT8U				powertime_modual;
	INT8S				powertime_active_id;
	INT8U				powertime_happened;

	//copy_file_counter;
	//	INT32U	Pre_Pow_off_state;
	INT8U				video_resolution;
	INT8U				reserved0;
	INT8U				reserved1;
	INT8U				reserved2;
	#if(GP_UI==General_UI )
	INT8U				reserved3;
	#else
	INT8U				big_language;           // For Touch UI use (Title use );
	#endif
	INT8U				reserved4;
	INT8U				reserved5;
	INT8U				reserved6;

	FM_INFO				FM_struct;
	INT8U				save_as_logo_flag;
	INT8S				alarm_volume1;
	INT8S				alarm_volume2;
	INT8U				alarm_mute1;
	INT8U				alarm_mute2;
	INT8U				ui_style;
	INT32U				base_day;
	INT8U 				is_updata;
	INT8U				ifdirty;
} USER_ITEMS;

typedef struct
{
	USER_ITEMS	item;
	INT8U		crc[4];
	INT8U		DUMMY_BYTE[512 - sizeof(USER_ITEMS) - 4];
} SYSTEM_USER_OPTION, *pSYSTEM_USER_OPTION;

/* ap music */
typedef struct
{
	INT8U	aud_state;
	BOOLEAN mute;
	INT8U	volume;
	INT8U	play_style;
} audio_status_st;

typedef enum
{
	STATE_IDLE,
	STATE_PLAY,
	STATE_PAUSED,
	STATE_AUD_FILE_ERR
} AUDIO_STATE_ENUM;

typedef enum
{
	//	PLAY_ONCE,
	PLAY_SEQUENCE,
	PLAY_REPEAT,
	PLAY_MIDI,
	PLAY_SPECIAL_REPEAT,
	PLAY_SPECIAL_BYNAME_REPEAT,
	PLAY_SHUFFLE_MODE
} AUDIO_PLAY_STYLE;

extern MSG_Q_ID ApQ;
extern INT8U ApQ_para[];
extern OS_EVENT *StateHandlingQ;

extern void state_handling_entry(void *para);
extern INT32U avi_encode_get_jpeg_enc_buf_addr(void);
#endif //__TASK_STATE_HANDLING_H__
